import { request as http } from "./request";

type ResType<T> = {
  message: string
  data: T
}
export type ChannelItem = {
  id: number
  name: string
}
type ChannelRes = {
  channels: ChannelItem[]
}
export const getChannelApi = () => {
  return http.request<ResType<ChannelRes>>({
    url: '/channels'
  })
}

export type ListItem = {
  art_id: string
  title: string
  aut_id: string
  comm_count: string
  pubbate: string
  aut_name: string
  is_top: number
  cover: {
    type: number
    images: string[]
  }
}
export type Listres = {
  results: ListItem[]
  pre_timestamp: string
}
type ReqParams = {
  channel_id: string
  timestamp: string
}
export const getListApi = (params: ReqParams) => {
  return http.request<ResType<Listres>>({
    url: '/articles',
    params
  })
}